package me.xuym.crawler.house58;

import com.cbs.java.component.application.Application;
import com.cbs.java.component.database.Database;
import com.cbs.java.component.database.mysql.MySqlDatabase;
import me.xuym.crawler.Processor;

import java.util.List;

/**
 * Created by broche on 10/09/2017.
 */
public class House58DeltaAddressLoader extends Processor<Object, List<House58DeltaAddress>> {
    private Database database;

    @Override
    protected List<House58DeltaAddress> onProcess(Object o) throws Exception {
        return database.query("select address from house58 where address not in (select address from house58address)", House58DeltaAddress.class);
    }

    public House58DeltaAddressLoader(Application application, String host, String port, String username, String password, String database) throws Exception {
        super(application);

        this.database = new MySqlDatabase(host, port, username, password, database);
    }
}
